package com.example.pwj.ffstudy.ui.gank.adapter;

import android.content.Context;

import com.example.pwj.ffstudy.R;
import com.example.pwj.ffstudy.bean.gank.GankData;
import com.example.pwj.ffstudy.bean.gank.GankSection;
import com.example.pwj.ffstudy.comm.CommSectionAdapter;
import com.example.pwj.ffstudy.comm.CommViewHolder;

/**
 * author：liluo
 * e-mail：lastcrazysun@163.com
 * company：cusc
 * date：2017/8/29 13:59
 * description：
 */

public class GankAdapter extends CommSectionAdapter<GankSection> {

    public GankAdapter(Context context) {
        super(context, R.layout.item_zhihu, R.layout.item_gank_section);
    }

    @Override
    protected void convertSection(CommViewHolder holder, GankSection gankSection) {
        holder.setText(R.id.tv_gank_section, gankSection.header);
    }

    @Override
    public void convert(CommViewHolder holder, GankSection gankSection) {
        GankData resultsBean = gankSection.t;
        if (null != resultsBean.getImages()) {
            holder.setImageUrl(R.id.iv_zhihu, resultsBean.getImages().get(0));
        }
        holder.setText(R.id.tv_zhihu, resultsBean.getDesc());
    }
}

